package com.kaifamiao.demo.d0719;

public class Demo06 {

    public static void main(String[] args) {

        int[] nums = {22, 11, -4, 5, 2, 99};

        int max = nums[0];
        int min = nums[0];
        // 遍历
        for (int i = 1; i < nums.length; i ++){
            if (nums[i] > max){
                max = nums[i];
            }
            if (nums[i] < min){
                min = nums[i];
            }
        }

        System.out.println("最大值：" + max);
        System.out.println("最小值：" + min);
    }
}
